import request from './request'

const common = {
    method: "get",
    data: {}
}

export default {
    //全部请求方式
    http: function (options = {}) {
        options.url = options.url;
        options.method = options.method || common.method;
        options.data = options.data || common.data;
        return request({
            ...options
        }).then(res => res.data)
    },
    get: function (url, data = {}, options = {}) {
        options.url = url;
        options.data = data;
        options.method = "get";
        return this.http(options)
    },
    post: function (url, data = {}, options = {}) {
        options.url = url;
        options.data = data;
        options.method = "post";
        return this.http(options)
    },
	del:function (url, data = {}, options = {}) {
        options.url = url;
        options.data = data;
        options.method = "delete";
        return this.http(options)
    }
}